package com.tj.bo.payment.client.enums;

import java.util.Objects;

/**
 * 支付订单状态
 *
 * @author ZhangChao
 * @since 2021/7/16
 */
public enum PayOrderStatusEnum {
    NOT_PAY(0),
    PAID(1),
    CANCELED(2);
    private final Integer code;


    PayOrderStatusEnum(Integer code) {
        this.code = code;
    }

    public Integer getCode() {
        return code;
    }

    public static PayOrderStatusEnum getEnum(Integer code){
        for (PayOrderStatusEnum payOrderStatusEnum : PayOrderStatusEnum.values()){
            if (Objects.equals(code, payOrderStatusEnum.getCode())){
                return payOrderStatusEnum;
            }
        }
        return null;
    }
}
